// JavaScript Document
function popUp(URL, WIDTH, HEIGHT) {
window.open(URL,'View_Member_Information',"toolbar=no,scrollbars=yes,location=no,statusbar=no,menubar=no,resizable=no,width="+WIDTH+",height="+HEIGHT+",left = 0,top = 0");
}

//cat bo hai dau khoang trang
function trim(val)
{ 
	return val.replace(/^\s+|\s+$/g,"");
}
//cho phep nhung ky tu tu A->Z, a->z, 0->9,va cac ky tu _-
function CheckUsernameChar(stringIn)
{
	retval = false
     var i;
     for ( i=0; i <= stringIn.length-1; i++) 
	 {
         if ( ( ( stringIn.charCodeAt(i) >= 48)&&(stringIn.charCodeAt(i) <= 57)) || ((stringIn.charCodeAt(i) > 64)&&(stringIn.charCodeAt(i) <= 90)) || ((stringIn.charCodeAt(i) >= 97)&&(stringIn.charCodeAt(i) <= 122)) || (stringIn.charCodeAt(i) == 95) || (stringIn.charCodeAt(i) == 45) )
		 {
           	retval = true;
         }
		 else
		 {
			retval = false;
			break;
         }
     }
     return retval;
}

//kiem tra unicode cho password Checkchar1
function CheckCharPassword(stringIn)
{
	retval = false
     var i;
     for (i=0;i<=stringIn.length-1;i++) 
	 {
         if (((stringIn.charCodeAt(i) >= 8)&&(stringIn.charCodeAt(i) <= 127)) && (stringIn.charCodeAt(i)!=34) && (stringIn.charCodeAt(i)!=39) && (stringIn.charCodeAt(i)!=32))
		 {
           	retval = true;
         }
		 else
		 {
			retval = false;
			break;
         }
     }
     return retval;
}

// kiem tra co dung la dia chi email.
function CheckEmail(stringIn)
{
	var re = /^([A-Za-z0-9\_\-]+\.)*[A-Za-z0-9\_\-]+@[A-Za-z0-9\_\-]+(\.[A-Za-z0-9\_\-]+)+$/;
	if ( stringIn.search(re) == -1 )
	{
		return false;
	}
	else
	{
		return true;
	}
}

// kiem tra so dien thoai
function CheckTel(str)
{
	var pattern = "0123456789-+() ";
	if (str.length > 0) {
		if (str.length < 5) {
			return false;
		} else {
			for (var a=0; a<pattern.length; a++) {
				if (pattern.indexOf(str.charAt(a),0) == -1) return false;
			}
		}
	}
	return true;	
}
function disableHandleForm(frm, flgDisable)
{
	for (var n=0; n < frm.elements.length; n++) 
		frm.elements[n].disabled = flgDisable;
}



function addfavourite()
{
         if (document.all)
        {
             // For IE
             window.external.AddFavorite(location.href, document.title);
         }
        else if (window.sidebar)
       {
             // For Firefox
             window.sidebar.addPanel(document.title, location.href, "");
        }
}